package com.example.myFirstWebmagic.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

/**
 * 
 * ClassName: ControllerLogAspect 
 * @Description: 日志输出切面
 * @author xiongyao
 * @date 2017年4月12日
 */
@Aspect
@Configuration
public class LogAspect {
	
	private static final Logger LOGGER= LoggerFactory.getLogger(LogAspect.class);
	
	@Around("@annotation(com.example.myFirstWebmagic.aspect.LogTag)")
	public Object around(ProceedingJoinPoint pjp) throws Throwable{
		before(pjp);
		Object result=pjp.proceed();
		after(pjp);
		return result;
	}
	
	private void before(ProceedingJoinPoint pjp) {
		// TODO Auto-generated method stub
		LOGGER.info("开始执行:"+pjp.getThis().getClass().getName()+":"+pjp.getSignature().getName());
	}

	private void after(ProceedingJoinPoint pjp) {
		// TODO Auto-generated method stub
		LOGGER.info("结束执行:"+pjp.getThis().getClass().getName()+":"+pjp.getSignature().getName());
	}

	
	
	
	
}
